package cn.stimd.spring.validation;

import cn.stimd.spring.beans.ConfigurablePropertyAccessor;
import org.springframework.core.convert.ConversionService;

/**
 * 该类表明是对属性进行绑定
 * <p>
 * Created by Stimd
 * 项目地址：https://gitee.com/stimd/spring-wheel
 * 公众号：Java编程探微
 */
public abstract class AbstractPropertyBindingResult extends AbstractBindingResult {

    public AbstractPropertyBindingResult(String objectName) {
        super(objectName);
    }


    public void initConversion(ConversionService conversionService) {
        if (getTarget() != null) {
            getPropertyAccessor().setConversionService(conversionService);
        }
    }


    //模版方法，由子类提供属性访问器
    public abstract ConfigurablePropertyAccessor getPropertyAccessor();
}
